home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / CodeWarrior Lite / Metrowerks C⁄C++ Lite / Headers / Universal Headers 2.0.1f / AppleGuide.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-22  |  10.1 KB  |  329 lines  |  [TEXT/MMCC]

  1. /*
  2.      File:        AppleGuide.h
  3.  
  4.      Contains:    Apple Guide Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __APPLEGUIDE__
  21. #define __APPLEGUIDE__
  22.  
  23.  
  24. #ifndef __APPLEEVENTS__
  25. #include <AppleEvents.h>
  26. #endif
  27. /*    #include <Errors.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <Types.h>                                            */
  30. /*    #include <Memory.h>                                            */
  31. /*        #include <MixedMode.h>                                    */
  32. /*    #include <OSUtils.h>                                        */
  33. /*    #include <Events.h>                                            */
  34. /*        #include <Quickdraw.h>                                    */
  35. /*            #include <QuickdrawText.h>                            */
  36. /*    #include <EPPC.h>                                            */
  37. /*        #include <AppleTalk.h>                                    */
  38. /*        #include <Files.h>                                        */
  39. /*        #include <PPCToolbox.h>                                    */
  40. /*        #include <Processes.h>                                    */
  41. /*    #include <Notification.h>                                    */
  42.  
  43. #ifndef __FILES__
  44. #include <Files.h>
  45. #endif
  46.  
  47. #ifndef __TYPES__
  48. #include <Types.h>
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54.  
  55. #if PRAGMA_ALIGN_SUPPORTED
  56. #pragma options align=mac68k
  57. #endif
  58.  
  59. #if PRAGMA_IMPORT_SUPPORTED
  60. #pragma import on
  61. #endif
  62.  
  63. typedef UInt32 AGRefNum;
  64.  
  65. typedef UInt32 AGCoachRefNum;
  66.  
  67. typedef UInt32 AGContextRefNum;
  68.  
  69. struct AGAppInfo {
  70.     AEEventID                        eventId;
  71.     long                            refCon;
  72.     void                            *contextObj;                /* private system field*/
  73. };
  74. typedef struct AGAppInfo AGAppInfo, *AGAppInfoPtr, **AGAppInfoHdl;
  75.  
  76. typedef pascal OSErr (*CoachReplyProcPtr)(Rect *pRect, Ptr name, long refCon);
  77. typedef pascal OSErr (*ContextReplyProcPtr)(Ptr pInputData, Size inputDataSize, Ptr *ppOutputData, Size *pOutputDataSize, AGAppInfoHdl hAppInfo);
  78.  
  79. #if GENERATINGCFM
  80. typedef UniversalProcPtr CoachReplyUPP;
  81. typedef UniversalProcPtr ContextReplyUPP;
  82. #else
  83. typedef CoachReplyProcPtr CoachReplyUPP;
  84. typedef ContextReplyProcPtr ContextReplyUPP;
  85. #endif
  86.  
  87. enum {
  88.     uppCoachReplyProcInfo = kPascalStackBased
  89.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  90.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Rect*)))
  91.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  92.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  93.     uppContextReplyProcInfo = kPascalStackBased
  94.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  95.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  96.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Size)))
  97.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Ptr*)))
  98.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Size*)))
  99.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AGAppInfoHdl)))
  100. };
  101.  
  102. #if GENERATINGCFM
  103. #define NewCoachReplyProc(userRoutine)        \
  104.         (CoachReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCoachReplyProcInfo, GetCurrentArchitecture())
  105. #define NewContextReplyProc(userRoutine)        \
  106.         (ContextReplyUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppContextReplyProcInfo, GetCurrentArchitecture())
  107. #else
  108. #define NewCoachReplyProc(userRoutine)        \
  109.         ((CoachReplyUPP) (userRoutine))
  110. #define NewContextReplyProc(userRoutine)        \
  111.         ((ContextReplyUPP) (userRoutine))
  112. #endif
  113.  
  114. #if GENERATINGCFM
  115. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  116.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppCoachReplyProcInfo, (pRect), (name), (refCon))
  117. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  118.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppContextReplyProcInfo, (pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  119. #else
  120. #define CallCoachReplyProc(userRoutine, pRect, name, refCon)        \
  121.         (*(userRoutine))((pRect), (name), (refCon))
  122. #define CallContextReplyProc(userRoutine, pInputData, inputDataSize, ppOutputData, pOutputDataSize, hAppInfo)        \
  123.         (*(userRoutine))((pInputData), (inputDataSize), (ppOutputData), (pOutputDataSize), (hAppInfo))
  124. #endif
  125.  
  126.  
  127. enum {
  128.     gestaltAppleGuidePresent    = 31,
  129.     gestaltAppleGuideIsDebug    = 30,
  130.     kAGDefault                    = 0,
  131.     kAGFrontDatabase            = 1,
  132.     kAGNoMixin                    = (-1)
  133. };
  134.  
  135. enum {
  136.     kAGViewFullHowdy            = 1,                            /* Full-size Howdy*/
  137.     kAGViewTopicAreas            = 2,                            /* Full-size Topic Areas*/
  138.     kAGViewIndex                = 3,                            /* Full-size Index Terms*/
  139.     kAGViewLookFor                = 4,                            /* Full-size Look-For (Search)*/
  140.     kAGViewSingleHowdy            = 5,                            /* Single-list-size Howdy*/
  141.     kAGViewSingleTopics            = 6                                /* Single-list-size Topics*/
  142. };
  143.  
  144. enum {
  145.     kAGFileMain                    = 'poco',
  146.     kAGFileMixin                = 'mixn'
  147. };
  148.  
  149. /* To test against AGGetAvailableDBTypes*/
  150. enum AGDBTypeBit {
  151.     kAGDBTypeBitAny                = 0x00000001,
  152.     kAGDBTypeBitHelp            = 0x00000002,
  153.     kAGDBTypeBitTutorial        = 0x00000004,
  154.     kAGDBTypeBitShortcuts        = 0x00000008,
  155.     kAGDBTypeBitAbout            = 0x00000010,
  156.     kAGDBTypeBitOther            = 0x00000080
  157. };
  158.  
  159. typedef UInt16 AGStatus;
  160.  
  161. /* Returned by AGGetStatus*/
  162.  
  163. enum {
  164.     kAGIsNotRunning,
  165.     kAGIsSleeping,
  166.     kAGIsActive
  167. };
  168.  
  169. typedef UInt16 AGWindowKind;
  170.  
  171. /* Returned by AGGetFrontWindowKind*/
  172.  
  173. enum {
  174.     kAGNoWindow,
  175.     kAGAccessWindow,
  176.     kAGPresentationWindow
  177. };
  178.  
  179. /* Error Codes*/
  180. /* Not an enum, because other OSErrs are valid.*/
  181. typedef SInt16 AGErr;
  182.  
  183. /* Apple Guide error codes*/
  184.  
  185. enum {
  186. /* -------------------- Apple event reply codes*/
  187.     kAGErrUnknownEvent            = -2900,
  188.     kAGErrCantStartup            = -2901,
  189.     kAGErrNoAccWin                = -2902,
  190.     kAGErrNoPreWin                = -2903,
  191.     kAGErrNoSequence            = -2904,
  192.     kAGErrNotOopsSequence        = -2905,
  193.     kAGErrReserved06            = -2906,
  194.     kAGErrNoPanel                = -2907,
  195.     kAGErrContentNotFound        = -2908,
  196.     kAGErrMissingString            = -2909,
  197.     kAGErrInfoNotAvail            = -2910,
  198.     kAGErrEventNotAvailable        = -2911,
  199.     kAGErrCannotMakeCoach        = -2912,
  200.     kAGErrSessionIDsNotMatch    = -2913,
  201.     kAGErrMissingDatabaseSpec    = -2914,
  202. /* -------------------- Coach's Chalkboard reply codes*/
  203.     kAGErrItemNotFound            = -2925,
  204.     kAGErrBalloonResourceNotFound = -2926,
  205.     kAGErrChalkResourceNotFound    = -2927,
  206.     kAGErrChdvResourceNotFound    = -2928,
  207.     kAGErrAlreadyShowing        = -2929,
  208.     kAGErrBalloonResourceSkip    = -2930,
  209.     kAGErrItemNotVisible        = -2931,
  210.     kAGErrReserved32            = -2932,
  211.     kAGErrNotFrontProcess        = -2933,
  212.     kAGErrMacroResourceNotFound    = -2934,
  213. /* -------------------- API reply codes*/
  214.     kAGErrAppleGuideNotAvailable = -2951,
  215.     kAGErrCannotInitCoach        = -2952,
  216.     kAGErrCannotInitContext        = -2953,
  217.     kAGErrCannotOpenAliasFile    = -2954,
  218.     kAGErrNoAliasResource        = -2955,
  219.     kAGErrDatabaseNotAvailable    = -2956,
  220.     kAGErrDatabaseNotOpen        = -2957,
  221.     kAGErrMissingAppInfoHdl        = -2958,
  222.     kAGErrMissingContextObject    = -2959,
  223.     kAGErrInvalidRefNum            = -2960,
  224.     kAGErrDatabaseOpen            = -2961,
  225.     kAGErrInsufficientMemory    = -2962
  226. };
  227.  
  228. /* Events*/
  229. /* Not an enum because we want to make assignments.*/
  230. typedef UInt32 AGEvent;
  231.  
  232. /* Handy events for AGGeneral.*/
  233.  
  234. enum {
  235. /* Panel actions (Require a presentation window).*/
  236.     kAGEventDoCoach                = 'doco',
  237.     kAGEventDoHuh                = 'dhuh',
  238.     kAGEventGoNext                = 'gonp',
  239.     kAGEventGoPrev                = 'gopp',
  240.     kAGEventHidePanel            = 'pahi',
  241.     kAGEventReturnBack            = 'gobk',
  242.     kAGEventShowPanel            = 'pash',
  243.     kAGEventTogglePanel            = 'patg'
  244. };
  245.  
  246. /* Functions*/
  247. /* AGClose*/
  248. /* Close the database associated with the AGRefNum.*/
  249. extern pascal AGErr AGClose(AGRefNum *refNum)
  250.  TWOWORDINLINE(0x7011, 0xAA6E);
  251. /* AGGeneral*/
  252. /* Cause various events to happen.*/
  253. extern pascal AGErr AGGeneral(AGRefNum refNum, AGEvent theEvent)
  254.  TWOWORDINLINE(0x700D, 0xAA6E);
  255. /* AGGetAvailableDBTypes*/
  256. /* Return the database types available for this application.*/
  257. extern pascal UInt32 AGGetAvailableDBTypes(void)
  258.  TWOWORDINLINE(0x7008, 0xAA6E);
  259. /* AGGetFrontWindowKind*/
  260. /* Return the kind of the front window.*/
  261. extern pascal AGWindowKind AGGetFrontWindowKind(AGRefNum refNum)
  262.  TWOWORDINLINE(0x700C, 0xAA6E);
  263. /* AGGetFSSpec*/
  264. /* Return the FSSpec for the AGRefNum.*/
  265. extern pascal AGErr AGGetFSSpec(AGRefNum refNum, FSSpec *fileSpec)
  266.  TWOWORDINLINE(0x700F, 0xAA6E);
  267. /* AGGetStatus*/
  268. /* Return the status of Apple Guide.*/
  269. extern pascal AGStatus AGGetStatus(void)
  270.  TWOWORDINLINE(0x7009, 0xAA6E);
  271. /* AGInstallCoachHandler*/
  272. /* Install a Coach object location query handler.*/
  273. extern pascal AGErr AGInstallCoachHandler(CoachReplyUPP coachReplyProc, long refCon, AGCoachRefNum *resultRefNum)
  274.  TWOWORDINLINE(0x7012, 0xAA6E);
  275. /* AGInstallContextHandler*/
  276. /* Install a context check query handler.*/
  277. extern pascal AGErr AGInstallContextHandler(ContextReplyUPP contextReplyProc, AEEventID eventID, long refCon, AGContextRefNum *resultRefNum)
  278.  TWOWORDINLINE(0x7013, 0xAA6E);
  279. /* AGIsDatabaseOpen*/
  280. /* Return true if the database associated with the AGRefNum is open.*/
  281. extern pascal Boolean AGIsDatabaseOpen(AGRefNum refNum)
  282.  TWOWORDINLINE(0x7006, 0xAA6E);
  283. /* AGOpen*/
  284. /* Open a guide database.*/
  285. extern pascal AGErr AGOpen(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, AGRefNum *resultRefNum)
  286.  TWOWORDINLINE(0x7001, 0xAA6E);
  287. /* AGOpenWithSearch*/
  288. /* Open a guide database and preset a search string.*/
  289. extern pascal AGErr AGOpenWithSearch(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, ConstStr255Param searchString, AGRefNum *resultRefNum)
  290.  TWOWORDINLINE(0x7002, 0xAA6E);
  291. /* AGOpenWithSequence*/
  292. /* Open a guide database and display a presentation window sequence.*/
  293. extern pascal AGErr AGOpenWithSequence(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short sequenceID, AGRefNum *resultRefNum)
  294.  TWOWORDINLINE(0x7004, 0xAA6E);
  295. /* AGOpenWithView*/
  296. /* Open a guide database and override the default view.*/
  297. extern pascal AGErr AGOpenWithView(FSSpec *fileSpec, UInt32 flags, Handle mixinControl, short viewNum, AGRefNum *resultRefNum)
  298.  TWOWORDINLINE(0x7005, 0xAA6E);
  299. /* AGQuit*/
  300. /* Make Apple Guide quit.*/
  301. extern pascal AGErr AGQuit(void)
  302.  TWOWORDINLINE(0x7010, 0xAA6E);
  303. /* AGRemoveCoachHandler*/
  304. /* Remove the Coach object location query handler.*/
  305. extern pascal AGErr AGRemoveCoachHandler(AGCoachRefNum *resultRefNum)
  306.  TWOWORDINLINE(0x7014, 0xAA6E);
  307. /* AGRemoveContextHandler*/
  308. /* Remove the context check query handler.*/
  309. extern pascal AGErr AGRemoveContextHandler(AGContextRefNum *resultRefNum)
  310.  TWOWORDINLINE(0x7015, 0xAA6E);
  311. /* AGStart*/
  312. /* Start up Apple Guide in the background.*/
  313. extern pascal AGErr AGStart(void)
  314.  TWOWORDINLINE(0x700A, 0xAA6E);
  315.  
  316. #if PRAGMA_IMPORT_SUPPORTED
  317. #pragma import off
  318. #endif
  319.  
  320. #if PRAGMA_ALIGN_SUPPORTED
  321. #pragma options align=reset
  322. #endif
  323.  
  324. #ifdef __cplusplus
  325. }
  326. #endif
  327.  
  328. #endif /* __APPLEGUIDE__ */
  329.